<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>

<body>
    <div>
        <input type="checkbox" name="aa" value="0" />0
        <input type="checkbox" name=" aa " value="1" />1
        <input type="checkbox" name=" aa " value="2" />2
        <input type="checkbox" name=" aa " value="3" />3
        <input type="button" onclick="abc()" value="提 交" />
        <div id="allselect"></div>
    </div>
</body>
<script>
    //   用jQuery编程实现获取选中复选框值

    function abc() {
        const arr = [];
        $(":checked").each(function (i) {
            arr[i] = $(this).val();
        })
        var val = arr.join(",");
        $("#allselect").text("选中的值= " + val)

    }

</script>

</html>